<template>
  <div class="continer">
    <div class="search-box">
      <a @click="Back" class="iconfont icon-zuojiantou black"></a>
      <div class="search">
        <i class="iconfont icon-fangdajing fdj"></i>
        <input @focus="Search" type="text" placeholder="尖椒" :value="title" />
      </div>
    </div>
    <div class="search-list">
      <div class="item" v-for="(item, index) in list" :key="index">
        <div class="big_picbox">
          <!-- <img :src="require(item.img)" /> -->
          <img :src="item.img" @click="ToShop(item.id)" />
          <!-- <img src="../../assets/near.png"> -->
        </div>
        <div class="content">
          <h5 class="shopname">{{ item.name }}</h5>
          <p class="sale">
            <span>月销售{{ item.sale }}万+</span
            ><span class="spec">起送¥{{ item.startprice }}</span
            ><span>基础运费¥{{ item.baseprice }}</span>
          </p>
          <p class="vip">{{ item.yhtext }}</p>
          <div class="product">
            <div
              @click="ToShop(item.id)"
              class="p-item"
              v-for="(item2, index2) in item.item"
              :key="index2"
            >
              <div class="picbox">
                <img :src="item2.img" />
              </div>
              <div class="text">
                <p>{{ item2.name }}</p>
                <p class="price">
                  ¥{{ item2.price }}
                  <del v-if="item2.oldprice > 0">¥{{ item2.oldprice }}</del>
                </p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  created() {
    this.title = this.$route.query.title;
    this.list = this.GetList();
  },

  data() {
    return {
      title: "",
      list: [],
    };
  },
  methods: {
    ToShop() {
      this.$router.push({
        path: "/Shop",
        query: {
          id: 1,
        },
      });
    },
    Back() {
      this.$router.go(-1);
    },
    Search() {
      this.$router.push({ name: "Search" });
    },
    //获取数据
    GetList() {
      let list = [
        {
          id: 1,
          name: "沃尔玛",
          //img:'http://www.dell-lee.com/imgs/vue3/near.png',
          img: require("@/assets/near.png"),

          sale: 1,
          baseprice: 5,
          startprice: 0,
          yhtext: "VIP尊享满89元减4元运费券（每月3张）",
          item: [
            {
              id: 1,
              name: "超甜橙子25…",
              oldprice: 100,
              price: 33.6,
              //img:  'http://www.dell-lee.com/imgs/vue3/tomato.png',
              img: require("@/assets/tomato.png"),
            },
            {
              id: 2,
              name: "甜草莓25…",
              oldprice: 0,
              price: 33.6,
              //img:  'http://www.dell-lee.com/imgs/vue3/tomato.png',
              img: require("@/assets/tomato.png"),
            },
            {
              id: 3,
              name: "番茄250g/份",
              oldprice: 0,
              price: 33.6,
              //img:  'http://www.dell-lee.com/imgs/vue3/tomato.png',
              img: require("@/assets/tomato.png"),
            },
          ],
        },
        {
          id: 2,
          name: "京东7FRESH生鲜",
          //img:'http://www.dell-lee.com/imgs/vue3/near.png',
          img: require("@/assets/near.png"),

          sale: 1,
          baseprice: 5,
          startprice: 0,
          yhtext: "VIP尊享满89元减4元运费券（每月3张）",
          item: [
            {
              id: 1,
              name: "超甜橙子25…",
              oldprice: 100,
              price: 33.6,
              //img:  'http://www.dell-lee.com/imgs/vue3/tomato.png',
              img: require("@/assets/tomato.png"),
            },
            {
              id: 2,
              name: "甜草莓25…",
              oldprice: 0,
              price: 33.6,
              //img:  'http://www.dell-lee.com/imgs/vue3/tomato.png',
              img: require("@/assets/tomato.png"),
            },
            {
              id: 3,
              name: "番茄250g/份",
              oldprice: 0,
              price: 33.6,
              //img:  'http://www.dell-lee.com/imgs/vue3/tomato.png',
              img: require("@/assets/tomato.png"),
            },
          ],
        },
        {
          id: 3,
          name: "百果园",
          //img:'http://www.dell-lee.com/imgs/vue3/near.png',
          img: require("@/assets/near.png"),

          sale: 1,
          baseprice: 5,
          startprice: 0,
          yhtext: "VIP尊享满89元减4元运费券（每月3张）",
          item: [
            {
              id: 1,
              name: "超甜橙子25…",
              oldprice: 100,
              price: 33.6,
              //img:  'http://www.dell-lee.com/imgs/vue3/tomato.png',
              img: require("@/assets/tomato.png"),
            },
            {
              id: 2,
              name: "甜草莓25…",
              oldprice: 0,
              price: 33.6,
              //img:  'http://www.dell-lee.com/imgs/vue3/tomato.png',
              img: require("@/assets/tomato.png"),
            },
            {
              id: 3,
              name: "番茄250g/份",
              oldprice: 0,
              price: 33.6,
              //img:  'http://www.dell-lee.com/imgs/vue3/tomato.png',
              img: require("@/assets/tomato.png"),
            },
          ],
        },
      ];
      return list;
    },
  },
};
</script>
<style lang="scss" scoped>
a {
  text-decoration: none;
}

.continer {
  padding: 0 18px;
  .search-box {
    margin-top: 24px;
    display: flex;
    justify-content: space-between;
    .search {
      flex: 1;
      display: flex;
      background: #f5f5f5;
      border-radius: 16px;
      height: 32px;
      position: relative;
      .fdj {
        position: absolute;
        left: 16px;
        top: 8px;
      }
      input {
        border-radius: 16px;
        width: 100%;
        border: none;
        outline: none;
        background: #f5f5f5;
        border: none;
        margin-left: 38px;
        font-family: PingFangSC-Regular;
        font-size: 14px;
        color: #b7b7b7;
        line-height: 16px;
      }
    }
    .black {
      font-family: PingFangSC-Regular;
      font-size: 16px;
      color: #333333;
      line-height: 32px;
      margin-right: 16.5px;
    }
  }
  .search-list {
    margin-top: 24px;
    .item {
      display: flex;
      .big_picbox {
        width: 56px;
        height: 56px;
        margin-right: 16px;
        img {
          width: 100%;
          height: 100%;
        }
      }
      .content {
        border-bottom: 1px solid #f1f1f1;
        font-family: PingFangSC-Regular;
        font-size: 13px;
        color: #333333;
        flex: 1;
        .shopname {
          font-family: PingFangSC-Regular;
          font-size: 16px;
          color: #333333;
        }
        .sale {
          margin: 8px 0px;
          .spec {
            margin: 0 16px;
          }
        }
        .vip {
          color: red;
          margin-bottom: 4px;
        }
        .product {
          margin-bottom: 12px;
          display: flex;
          justify-content: space-between;
          .p-item {
            flex: 33.33333333%;

            .picbox {
              width: 76px;
              height: 76px;
              margin-bottom: 4px;
              img {
                width: 100%;
                height: 100%;
              }
            }
            .text {
              font-family: PingFangSC-Regular;
              font-size: 12px;
              color: #333333;
              .price {
                margin-top: 4px;
                font-family: PingFangSC-Regular;
                font-size: 14px;
                color: #e93b3b;
                del {
                  font-family: PingFangSC-Regular;
                  font-size: 10px;
                  color: #999999;
                }
              }
            }
          }
        }
      }
    }
    .item:nth-child(n + 1) {
      margin-top: 12px;
    }
  }
}
</style>